home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: Norman Bullen <nbullen@ix.netcom.com>
- Newsgroups: comp.lang.c
- Subject: Re: How to make this code portable?
- Date: Sun, 03 Mar 1996 09:44:41 -0800
- Organization: Black Cat Associates
- Message-ID: <3139DA89.3CA1@ix.netcom.com>
- References: <4h8k9j$78r@habs.ee.ubc.ca> <4hbsaa$fmu@news.acns.nwu.edu>
- NNTP-Posting-Host: ple-ca9-22.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-NETCOM-Date: Sun Mar 03 9:53:54 AM PST 1996
- X-Mailer: Mozilla 2.0 (Win16; I)
-
- Usman Muzaffar wrote:
- >
- > In article <4h8k9j$78r@habs.ee.ubc.ca>, Ellen Ho <ellenh@ee.ubc.ca> wrote:
- > >I am writing a program that I want to compile and run on both a Sun
- > >Sparcstation and a PC running OS/2 Warp. On the Sun, I compile the .c
- > >files with gcc. On the PC, I am using Visual Age.
- > >
- > >The program acceptes a list of filenames as command line
- > >arguments and does some processing with the list of files.
- > >On the Sun, I specify
- > >
- > > program *.txt
- > >
- > >and the shell will expand the wildcard into the names of all .txt
- > >files in the current working directory. So with a for loop in
- > >my C program I can go through each file and process the data.
- > >
- > >However, on the PC, "*.txt" is passed into my program as
- > >command line argument as is. This means that I may have to
- > >put in extra operating system dependent logic to expand the wildcard
- > >inside my program.
- > >
- > >Are there other ways to handle this?
- >
- > I think the best way to approach this is to write a dos batch file
- > that reads all .txt files and feeds them to your code. Or, if that's
- > not easy, just write a couple of lines of which do it and call that
- > as a frontend. Your main code stays untouched.
- The Borland C compilers include a library routine that can be invoked as
- part of the start-up module that expands *.txt into a list of filename so
- that it appears to your code just as it would on Unix. Look for
- "wildargs" in the documentation.
-